#ifndef ZUCMOTCFG_H
#define ZUCMOTCFG_H

#define ZUCMOT_MAX_AXIS_GROUP 3
#define ZUCMOT_MAX_JOINTS 9
#define ZUCMOT_MAX_AXIS 9  //ZUCMOT_MAX_JOINTS和ZUCMOT_MAX_AXIS数值保持一致,因多处两者的使用相混
#define ZUCMOT_JOINT_NUM 6
#define ZUCMOT_ROBOT_MAX_JOINTS 7  // max joint num for each robot
// shared for all kinds of cabinet
#define ZUCMOT_UINT16_AIO_NUM 16
#define ZUCMOT_INT16_AIO_NUM 16
#define ZUCMOT_FLOAT32_AIO_NUM 32
#define ZUCMOT_MAX_MODBUS_AIO_NUM (ZUCMOT_FLOAT32_AIO_NUM + ZUCMOT_UINT16_AIO_NUM + ZUCMOT_INT16_AIO_NUM)  // modbus aio number
#define ZUCMOT_MAX_MODBUS_DIO 128
#define ZUCMOT_MAX_MODBUS_AIO (ZUCMOT_FLOAT32_AIO_NUM * 2 + ZUCMOT_UINT16_AIO_NUM + ZUCMOT_INT16_AIO_NUM)  //modbus aio register num

//TIO number
#define ZUCMOT_MAX_TIO_DIO 4
// profinet IO nummber
#define ZUCMOT_MAX_PNDev_DIO 64
#define ZUCMOT_PNDev_INT_AIO_NUM 32
#define ZUCMOT_PNDev_FLOAT_AIO_NUM 32
#define ZUCMOT_MAX_PNDev_AIO_NUM (ZUCMOT_PNDev_INT_AIO_NUM + ZUCMOT_PNDev_FLOAT_AIO_NUM)

// Eternet/IP IO nummber
#define ZUCMOT_MAX_EIP_DIO 64
#define ZUCMOT_EIP_INT_AIO_NUM 24
#define ZUCMOT_EIP_FLOAT_AIO_NUM 24
#define ZUCMOT_MAX_EIP_AIO_NUM (ZUCMOT_EIP_INT_AIO_NUM + ZUCMOT_EIP_FLOAT_AIO_NUM)
#define ZUCMOT_NEWMODE_MAX_EIP_DIO 3936  // if Mode = 1, max DIO number: 492x8 = 4936

#define ZUCMOT_MAX_MODBUS_PHYSIC_AI 2  //cab v1.0 only has 2 input register
#define ZUCMOT_MAX_DIO 208             // 16 + 128 + 64
#define ZUCMOT_MAX_AIO 136             // 120 + 32 + 32

//TIO number
#define ZUCMOT_MAX_TIO_DIO 4

// cab 1.0
#define ZUCMOT_ZLAN_DIO_NUM 8
#define ZUCMOT_ZLAN_AI_NUM 8
#define ZUCMOT_ZLAN_AO_NUM 0

// cab 2.1
#define ZUCMOT_TOTAL_SCB_DIO_NUM 32
#define ZUCMOT_SCB_USER_DIO_NUM 16
#define ZUCMOT_SCB_USER_AIO_NUM 2

// cab mini
#define ZUCMOT_MINI_USER_DIO_NUM 7
#define ZUCMOT_MINI_USER_AIO_NUM 0

#define ZUCMOT_MAX_MODBUS_DI 40
#define ZUCMOT_MAX_MODBUS_DO 40
#define ZUCMOT_MAX_SCB_DI 32
#define ZUCMOT_MAX_SCB_DO 32
#define ZUCMOT_SCB_USER_DI_NUM 16
#define ZUCMOT_SCB_USER_DO_NUM 16

#if (ZUCMOT_MAX_DIO > 208) || (ZUCMOT_MAX_AIO > 136)
#error A 64 bit bitmask is used in the planner.  Don't increase these until that's fixed.
#endif

#define ZUCMOT_ERROR_NUM 32   /* how many errors we can queue */
#define ZUCMOT_ERROR_LEN 1024 /* how long error string can be */

/*
  Shared memory keys for simulated motion process. No base address
  values need to be computed, since operating system does this for us
  */
#define DEFAULT_SHMEM_KEY 100

/* default comm timeout, in seconds */
#define DEFAULT_ZUCMOT_COMM_TIMEOUT 1.0
/* seconds to delay between comm retries */
#define DEFAULT_ZUCMOT_COMM_WAIT 0.010

/* initial velocity, accel used for coordinated moves */
#define DEFAULT_VELOCITY 1.0
#define DEFAULT_ACCELERATION 10.0

/* maximum and minimum limit defaults for all axes */
#define DEFAULT_MAX_LIMIT 1000
#define DEFAULT_MIN_LIMIT -1000

#define DEFAULT_DIO_CAB_V21 48
#define DEFAULT_DIO_CAB_V10 39
#define DEFAULT_DIO_CAB_MINI 39
#define DEFAULT_AIO 32  //

/* size of motion queue
 * a TC_STRUCT is about 512 bytes so this queue is
 * about a megabyte.  */
#define DEFAULT_TC_QUEUE_SIZE 2000

#define DEFAULT_TC_QUEUE_SIZE_TOPPRA 30
/* max following error */
#define DEFAULT_MAX_FERROR 100

#endif